package com.cx.service.impl;


import com.cx.mapper.GoodsMapper;
import com.cx.mapper.OrderGoodsMapper;
import com.cx.mapper.OrdersMapper;
import com.cx.pojo.Goods;
import com.cx.pojo.OrderGoods;
import com.cx.pojo.Orders;
import com.cx.service.MyOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyOrderServiceImpl implements MyOrderService {

    @Autowired
    OrdersMapper ordersMapper;

    @Autowired
    OrderGoodsMapper orderGoodsMapper;

    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public List<Orders> getListByUserid(int userId) {
        return ordersMapper.selectByUserid(userId);
    }

    @Override
    public List<OrderGoods> getListByOrderId(int orderId) {
        return orderGoodsMapper.getListByOrderId(orderId);
    }

    @Override
    public int countOrderGood(int orderId) {
        return orderGoodsMapper.countOrderGood(orderId);
    }

    @Override
    public Goods selectGoodsByGoodId(int goodId) {
        return goodsMapper.findByGoodId(goodId);
    }
}
